//
//  UIFactory.swift
//  sinaWeibo
//
//  Created by liii on 16/7/21.
//  Copyright © 2016年 liii. All rights reserved.
//

import UIKit

// 抽象工厂
class UIFactory {
    
    /// UILabel
    class func labelWithText(text: String, fontSize: CGFloat, textColor: UIColor, alpha: CGFloat = 1, alignment: NSTextAlignment = .Center) -> UILabel {
        let l = UILabel.labelWithText(text, fontSize: fontSize, textColor: textColor, alpha: alpha, alignment: alignment)
        return l
    }
    
    /// UIButton
    class func buttonWithImage(image: String?, backgroundImage: String?) -> UIButton {
        let b = UIButton.buttonWithImage(image, backgroundImage: backgroundImage)
        return b
    }
    class func buttonWithTitle(title: String, fontSize: CGFloat?, color: UIColor?, backgroundImage: String?, image: String? = nil) -> UIButton {
        let b = UIButton.buttonWithTitle(title, fontSize: fontSize, color: color, backgroundImage: backgroundImage, image: image)
        return b
    }
    
    /// UIView
    class func lineViewColor(color: UIColor = UIColor.darkGrayColor()) -> UIView {
        let u = UIView.lineViewColor(color)
        return u
    }
    
    /// UITextView
    class func textViewWithText(text: String?, fontSize: CGFloat, textColor: UIColor = UIColor.grayColor(), backgroundColor: UIColor = UIColor.orangeColor()) -> UITextView {
        let t = UITextView.textViewWithText(text, fontSize: fontSize, textColor: textColor, backgroundColor: backgroundColor)
        return t
    }
}
